<!--团队管理-->
<template>
  <view class="anchor-console-page">
    <view class="box_title">
      <c-navigation-bar :title="$t('user.memberList')" />
    </view>
    <view class="box_content">

      <view class="box_item" v-for="(item, index) in userList" :key="index" @click="click2UserInfo(item.id)">
        <view class="box_head_name">
          <u-avatar size="96" :src="$u.file.getMedieUrl(item.avatar)"/>
          <view class="box_name">
            <text style="color: #111118;font-size: 30rpx">{{ item.nickName }}</text>
            <text style="color: #919191;font-size: 24rpx">{{ item.level }}</text>
          </view>
        </view>
        <text style="color: #91909A;font-size: 28rpx">
	
				{{publicJS.timeZoneSwitching(item.createTime,"DD/MM/YYYY")}}
				</text>
      </view>

      <view v-show="showNoDataView"
          style="display: flex;flex-direction: column;
          width: 100%;
          margin-top: 400rpx;
          justify-content: center;
          align-items: center">
        <image style="width: 200rpx;height: 200rpx" src="/static/images/no-data.png"/>
        <text style="color: #91909A">no data</text>
      </view>

    </view>
  </view>
</template>

<script>

export default {
  components: {},
  data() {
    return {
      showNoDataView: false,//缺省图
      userList: [],//展示列表,
      typeIndex: 0, //0 个人团队 1店铺团队
    };
  },
  onLoad(option) {
    console.log("===z index=" + option.index + "  id=" + option.id)
    this.typeIndex = option.index;
    this.getData(option.index, option.id);
  },

  methods: {
   
    click2UserInfo(id) {
      if (this.typeIndex == 0) {
        uni.navigateTo({
          url: '/pages/user/components/userInfo?userId=' + id
        })
      } else {
        //店铺详情
        uni.navigateTo({
          url:'/pages/shop/shopDetails?shopId=' + id
        })
      }
    },
    getData(index, id) {
      //0 个人团队 1店铺团队
      let url
      if (index == 0) {
        url = '/app/userStatisticsTeam/page/getUserlist'
      } else {
        url = 'app/shopStatisticsTeam/page/getUserShoplist'
      }
      this.$u.post(url, {
        size: 999,
        pageNum: 1,
        id: id
      }).then(res => {
        console.log('===z', res);
        if (res.data.records.length > 0) {
          this.userList = res.data.records
        } else {
          this.showNoDataView = true
        }
      }).catch(err => {
        console.error("===z err=" + err)
        this.showNoDataView = true
      })
    }
  },
}
</script>

<style lang="scss" scoped>
.anchor-console-page {
  .box_title {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999; /* 设置一个比较高的z-index值，保证标题区域在最上层显示 */
  }

  .box_content {
    margin-top: 220rpx;
    display: flex;
    flex-direction: column;

    .box_item {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      margin-left: 40rpx;
      margin-right: 40rpx;
      margin-top: 20rpx;
      margin-bottom: 20rpx;

      .box_head_name {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;

      }

      .box_name {
        margin-left: 28rpx;
        display: flex;
        flex-direction: column;
        justify-content: center;
      }


    }


  }

  .top {
    padding: 56rpx;

    .title {
      display: flex;
      justify-content: space-between;

      uni-text {
        font-size: 72rpx;
        font-weight: 400;
        color: #02010E;
      }
    }

  }
}

</style>
